package com.gpframework.module.base.domain.req;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gpframework.common.utils.StringUtils;
import com.gpframework.module.base.domain.BaseDeviceInfoLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * @ClassName BaseDeviceInfoLogReq
 * @Author gpframework
 * @Date 2023-05-17
 * @Version 1.0.0
 * @Description 列表查询信息体
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
public class BaseDeviceInfoLogReq extends BaseReq {
    private static final long serialVersionUID = 1L;

         @ApiModelProperty("ID")
     private Long baseDeviceInfoLogId;
     @ApiModelProperty("品牌id")
     private Long brandId;
     @ApiModelProperty("门店id")
     private Long storeId;
     @ApiModelProperty("品牌名称")
     private String brandName;
     @ApiModelProperty("店铺名称")
     private String storeName;
     @ApiModelProperty("设备id")
     private Long deviceInfoId;
     @ApiModelProperty("设备序列号。base_device_info#device_sn")
     private String deviceSn;
     @ApiModelProperty("设备用户id")
     private String deviceUserId;
     @ApiModelProperty("业务类型;例如：智慧前台。")
     private String businessType;
     @ApiModelProperty("业务名称")
     private String businessName;
     @ApiModelProperty("涉及的数据Class")
     private String dataClass;
     @ApiModelProperty("涉及的数据JSON;建议是JSON字符串")
     private String dataJson;
     @ApiModelProperty("日志内容")
     private String content;
     @ApiModelProperty("排序")
     private Long sort;
     @ApiModelProperty("备注")
     private String remarks;
     @ApiModelProperty("创建者")
     private String createBy;
     @ApiModelProperty("创建时间")
     private Date createTime;
     @ApiModelProperty("更新者")
     private String updateBy;
     @ApiModelProperty("更新时间")
     private Date updateTime;
     @ApiModelProperty("删除标记;0未删除。1已删除。")
     private Long delStatus;

    /**
    * @Description 生成查询wrapper
    * @Author greatplan@qq.com
    * @Date 2020-11-04 16:04
    * @Param [lqw]
    * @Param [isVO] 是否vo查询体，true的话走的是mapper.xml里面的查询语句，不过查询语法还是mybatis-plus，主要用于某些关联查询出一些非数据表字段
    * @Return void
    */
    public void generatorQuery(QueryWrapper<BaseDeviceInfoLog> lqw, boolean isVo) {
        String alias = "";
        if (isVo) {
            alias = "gp.";
            lqw.eq(alias+"del_status",0);
        }
        if (this.getBaseDeviceInfoLogId() != null){
        lqw.eq(alias+"base_device_info_log_id" ,this.getBaseDeviceInfoLogId());
        }
        if (this.getBrandId() != null){
        lqw.eq(alias+"brand_id" ,this.getBrandId());
        }
        if (this.getStoreId() != null){
        lqw.eq(alias+"store_id" ,this.getStoreId());
        }
        if (StringUtils.isNotBlank(this.getBrandName())){
            lqw.like(alias+"brand_name",this.getBrandName());
        }
        if (StringUtils.isNotBlank(this.getStoreName())){
            lqw.like(alias+"store_name",this.getStoreName());
        }
        if (this.getDeviceInfoId() != null){
        lqw.eq(alias+"device_info_id" ,this.getDeviceInfoId());
        }
        if (StringUtils.isNotBlank(this.getDeviceSn())){
            lqw.like(alias+"device_sn",this.getDeviceSn());
        }
        if (StringUtils.isNotBlank(this.getDeviceUserId())){
        lqw.eq(alias+"device_user_id" ,this.getDeviceUserId());
        }
        if (StringUtils.isNotBlank(this.getBusinessType())){
        lqw.eq(alias+"business_type" ,this.getBusinessType());
        }
        if (StringUtils.isNotBlank(this.getBusinessName())){
            lqw.like(alias+"business_name",this.getBusinessName());
        }
        if (StringUtils.isNotBlank(this.getDataClass())){
            lqw.like(alias+"data_class",this.getDataClass());
        }
        if (StringUtils.isNotBlank(this.getDataJson())){
        lqw.eq(alias+"data_json" ,this.getDataJson());
        }
        if (StringUtils.isNotBlank(this.getContent())){
            lqw.like(alias+"content",this.getContent());
        }
        if (this.getSort() != null){
        lqw.eq(alias+"sort" ,this.getSort());
        }
        if (StringUtils.isNotBlank(this.getRemarks())){
        lqw.eq(alias+"remarks" ,this.getRemarks());
        }
        if (StringUtils.isNotBlank(this.getCreateBy())){
        lqw.eq(alias+"create_by" ,this.getCreateBy());
        }
        if (StringUtils.isNotBlank(this.getUpdateBy())){
        lqw.eq(alias+"update_by" ,this.getUpdateBy());
        }
        if (this.getDelStatus() != null){
        lqw.eq(alias+"del_status" ,this.getDelStatus());
        }
    }
}
